package in.muton.panels.paginator.helpers.deletelinks;

import in.muton.edushare.pages.common.EdusharePanel;
import in.muton.panels.paginator.badgehelpers.course.ProgramBadgeInterface;

import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.IModel;

import com.edushare.common.vo.Curricula;

public class CurriculaRemove extends Link<Void> {
	private static final long serialVersionUID = -6983892540874301358L;

	public CurriculaRemove(String id, EdusharePanel panel,
			IModel<Curricula> curr, ProgramBadgeInterface bif) {
		super(id);
		this.currModel = curr;
		this.panel = panel;
		this.bif = bif;
	}

	@Override
	public void onClick() {
		if (bif != null)
			panel.setError(bif.removeBadge(currModel));
	}

	@Override
	public boolean isVisible() {
		return bif != null && bif.isAdmin();
	}

	private IModel<Curricula> currModel = null;
	private EdusharePanel panel = null;
	private ProgramBadgeInterface bif;
}